/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aiaudio.processing.base.helpers.latex;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import static aiaudio.processing.base.helpers.latex.TexConstants.*;

/**
 *
 * @author nastya
 */
public class TexFile {

    private String fileName;
    private BufferedWriter writer;

    public TexFile(String fileName) {
        this.fileName = fileName;
    }

    public BufferedWriter getWriter() {
        return writer;
    }

    public void open() throws IOException {
        writer = new BufferedWriter(new FileWriter(fileName));
        writer.write(DOCUMENT_CLASS);
        writer.write(TABLE_ARRAY);
        writer.write(DOCUMENT_BEGIN);
    }

    public void close() throws IOException {
        writer.write(DOCUMENT_END);
        writer.flush();
        writer.close();
    }
}
